/**
 * 
 */
package com.dycn.posdashboard.job;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.InterruptableJob;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.UnableToInterruptJobException;

import com.dycn.posdashboard.services.SyncTransactionDataServices;

/**
 * POS交易数据同步到本地Job
 * @author gongqiyi
 *
 */
public class PosTransactionDataSyncJob implements InterruptableJob {
    
	protected final Log log = LogFactory.getLog(getClass());

	private boolean _interrupted = false;
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		// TODO Auto-generated method stub
		String  jobName=context.getJobDetail().getFullName();
		
        JobDetail job = context.getJobDetail();
        SyncTransactionDataServices syncTransactionDataServices = (SyncTransactionDataServices) job.getJobDataMap().get("syncTransactionDataServices");
 
        syncTransactionDataServices.syncTransactionWithRemotePOSSystem("");
        
		log.info("---- " + jobName + " executing at " + new Date());
		
	}
	
	@Override
	public void interrupt() throws UnableToInterruptJobException {
		// TODO Auto-generated method stub
		log.info("---" + " -- INTERRUPTING --");
		_interrupted=true;
	}
    
}
